<?php

class dojsc {
    
    public $jsc_routes = ['pob', 'cde', 'pom', 'mpod'];
    public function tasks() {
        check_routes($method);
        $lock_key = "tasks_lock_time_dojsc";
        $bool = mredis::get($lock_key);
        if (empty($bool)) {
            try {
                mredis::setnxe($lock_key, 1, 10);
                $this->toDo();
                mredis::del($lock_key);
            } catch (Exception $ex) {
                logging_run('任务处理出错：' . $ex->getMessage(), 'error', 'dokeyword_run');
                mredis::del($lock_key);
            }
        } else {
            logging_run('任务正在处理中', 'trace', 'dokeyword_run');
        }
    }

    public function toDo() {
        $yumings = db::select("select * from `yuming` where autojsc=1");
        foreach($yumings as $yuming) {
            for($i=1;$i<=200;$i++) {
                $urls[] = create_jscurl($yuming['name']);
            }
            $bool = yumi::baidu_push_jsc_url($yuming['id'],$urls);
        }
    }

    

}
